<template>
  <px-dialog v-model="visible" title="点检记录">
    <px-table :data="tableData" size="small" border class="common-table">
      <px-table-column type="index" label="序号" fixed width="55" align="center" />
      <px-table-column prop="checkTime" label="日期" show-overflow-tooltip />
      <px-table-column prop="name" label="人员" show-overflow-tooltip />
    </px-table>
    <template #footer>
      <span class="dialog-footer">
        <px-button @click="cancelSpotCheck">取消</px-button>
        <px-button type="primary" @click="submitSpotCheck">确定</px-button>
      </span>
    </template>
  </px-dialog>
</template>

<script setup>
import { defineProps, defineEmits, computed } from "vue";

const emits = defineEmits(["update:visible"]);

const props = defineProps({
  visible: {
    type: Boolean,
    default: false
  },
  tableData: {
    type: Array,
    default: () => []
  }
});

const visible = computed({
  get: () => props.visible,
  set: val => emits("update:visible", val)
});

// 点检取消按钮
const cancelSpotCheck = () => {
  emits("update:visible", false);
};

// 点检弹框确认按钮
const submitSpotCheck = () => {
  emits("update:visible", false);
};
</script>
